package com.example.databasedemo.slice;

import ohos.data.orm.OrmObject;
import ohos.data.orm.annotation.Entity;
import ohos.data.orm.annotation.PrimaryKey;
// 标注当前类为数据库表的映射类
@Entity(tableName = "student", ignoredColumns = {"classroom"})
public class Student extends OrmObject {
    // 定义表中的字段
    @PrimaryKey(autoGenerate = true)
    private int id;
    private String name;
    private int age;
    private String subject;
    private String classroom;

    public String getClassroom() {
        return classroom;
    }

    public void setClassroom(String classroom) {
        this.classroom = classroom;
    }

    // 对应的定义setter与getter方法
    public void setId(int id) {
        this.id = id;
    }
    public void setName(String name) {
        this.name = name;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public void setSubject(String subject) {
        this.subject = subject;
    }
    public int getId() {
        return id;
    }
    public String getName() {
        return name;
    }
    public int getAge() {
        return age;
    }
    public String getSubject() {
        return subject;
    }
}
